import http from '@/utils/http'

/**
 * login func
 * @param parameter
 * @returns {*}
 */
export function login (parameter) {
  return http({
    url: '/login',
    method: 'post',
    data: http.adornData(parameter)
  })
}

export function getInfo () {
  return http({
    url: '/getLoginUserInfo',
    method: 'get'
  })
}

export function logout () {
  return http({
    url: '/logout',
    method: 'delete',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

// 获取验证码
export function getCodeImg () {
  return http({
    url: '/captcha',
    method: 'get',
    timeout: 20000
  })
}

// 注册方法
export function register (data) {
  return http({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: http.adornData(data)
  })
}
